<?php

/**
 * @Author: ddyake
 * @Date:   2020-12-20 13:21:20
 * @Last Modified by:   ddyake
 * @Last Modified time: 2020-12-21 01:22:28
 */
$json = array('status'=>'ok','msg'=>'ok','data'=>'');

$params = $this->params();
$sys = $this->website['class']['unity']->configura('sys');

$p = $params['p']??1;


if(!($params['tid']??false) || !($params['sid']??false)){
  $json['data'] = array('data'=>[]);
}else{
  $json['status'] = 'ok';
  $json['msg'] = 'ok';
  $this->website['class']['db']
       ->table('product')
       ->page($p)
       ->num($sys['pagingnum'])
       ->order('id desc');

  if($params['tid']>0){
    $json['data'] = $this->website['class']['db']
                    ->where('sid=? and tid=?',$params['sid'],$params['tid']);
  }else{
    $json['data'] = $this->website['class']['db']
                    ->where('sid=? and shopsrecommend=1',$params['sid']);
  }
  $json['data']=$this->website['class']['db']->paging();
}




$this->json_encode_encrypt($json);